<?php
/**
 * @package     Api.php
 * @author      Jing <tangjing3321@gmail.com>
 * @link        http://www.slimphp.net
 * @version     1.0
 * @copyright   Copyright (c) SlimCustom.
 * @date        2017年6月5日
 */

namespace SlimCustom\Libs\Controller;

/**
 * Restful Api
 * 
 * @author Jing <tangjing3321@gmail.com>
 */
class Api extends Controller
{
    /**
     * 客户端允许请求的contenType
     * 
     * @var array
     */
    protected $allowedContentTypes = [
        'application/json',
//         'application/xml',
    ];
    
    /**
     * 默认响应 application/json
     * 
     * @var string
     */
    protected $defaultContentType = 'application/json';

    /**
     * Api 初始化
     */
    public function __construct()
    {
        parent::__construct();
        response()->setAllowedContentTypes($this->allowedContentTypes)
                  ->setDefaultContentType($this->defaultContentType);
    }
}